package com.woniuxy.ptapp.client;
import com.woniuxy.commons.util.Result;
import com.woniuxy.ptapp.client.param.ByClassesParam;
import com.woniuxy.ptapp.client.param.ClassesOrderDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.List;

@Api(tags = "课程接口")
@Component
@FeignClient(value = "yoga-pt",path="/pt",contextId ="ClassesOrderClient")
public interface ClassesOrderClient {

    @ApiOperation("下订单课程(学员)")
    @PostMapping("/byClasses")
    public Result<Boolean> Orders(@RequestBody ByClassesParam byClassesParam);

    @ApiOperation("支付宝方式支付订单(学员)")
    @GetMapping("/payClasses")
    public void payClasses(@RequestParam String orderNumber) throws Exception;

    @ApiOperation("获取登录人的所有订单(所有人)")
    @GetMapping("/showClassesOrder")
    public Result<List<ClassesOrderDto>> showClassesOrder();

    @ApiOperation("接单接口(场馆、教练)")
    @GetMapping("/takeOrder")
    public Result takeOrder(@RequestParam Integer id);

    @ApiOperation("拒单接口(场馆、教练)")
    @GetMapping("/rejectionOrders")
    public Result rejectionOrders(@RequestParam Integer id,@RequestParam String refuseReason);

    @ApiOperation("通过订单id查到订单对象（其他服务调用）")
    @GetMapping("/getClassesOrderById")
    public Result<ClassesOrderDto> getClassesOrderById(@RequestParam Integer id);

    @ApiOperation("通过订单id修改订单状态,支付方式（其他服务调用）")
    @GetMapping("/changeOrderState")
    public Result changeOrderState(@RequestParam("id") Integer id,@RequestParam("orderState") Integer orderState,@RequestParam(value = "payment") Integer payment,@RequestParam("payTime")  String payTime);

    @ApiOperation("教练确认上课完成接口(教练)")
    @GetMapping("/finishClassesOreder/coach")
    public Result finishClassesOreder(@RequestParam Integer id);

    @ApiOperation("学员取消订单接口(学员)")
    @GetMapping("/studentCancelOrder/student")
    public Result studentCancelOrder(@RequestParam Integer id);
}
